package com.memorywords.mapper;

import com.memorywords.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    //注册
    @Insert("insert into user(username, password, email)" +
            " values(#{username}, #{password}, #{email})")
    void add(String username, String password, String email);

    //根据用户名查询用户
    @Select("select * from user where username=#{username};")
    User findByUserName(String username);

    //修改密码
    @Update("update user set password=#{md5String} where user_id=#{id}")
    void exitPwd(String md5String, Integer id);

    //更新进度
    @Update("update user set progress=#{progress} where user_id=#{id}")
    void updatePgs(int progress, int id);
}
